package com.bj58.mis.apm.server.kylin.model;

import java.util.*;

public class Segment {
    private String uuid;
    private String name;
    private String status;
    private Long size_kb;
    private Integer input_records;
    private Long input_records_size;
    private Long last_build_time;
    private String last_build_job_id;
    private Long create_time_utc;
    private Map<String, String> dictionaries;
    private List<Object[]> rowkey_stats;

    private Double swell;

    private Date d_last_build_time;
    private Date d_create_time_utc;
    private List<Map<String, Object>> rowkeyStats;

    private Cube cube;

    public Segment(){}

    public Segment deal(){
        if(this.size_kb != null && this.input_records_size != null && this.size_kb > 0 && this.input_records_size > 0) {
            swell = this.size_kb * 1024.00 / this.input_records_size;
        }

        this.d_last_build_time = new Date(this.last_build_time);
        this.d_create_time_utc = new Date(this.create_time_utc);

        rowkeyStats = new ArrayList<>();
        for(Object[] obj : rowkey_stats){
            Map<String, Object> map = new HashMap<>();
            map.put("rowkey",obj[0]);
            map.put("rowkey_count",obj[1]);
            map.put("rowkey_stat",obj[2]);
            map.put("segment_id",this.uuid);
            rowkeyStats.add(map);
        }

        return this;
    }

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Long getSize_kb() {
        return size_kb;
    }

    public void setSize_kb(Long size_kb) {
        this.size_kb = size_kb;
    }

    public Integer getInput_records() {
        return input_records;
    }

    public void setInput_records(Integer input_records) {
        this.input_records = input_records;
    }

    public Long getInput_records_size() {
        return input_records_size;
    }

    public void setInput_records_size(Long input_records_size) {
        this.input_records_size = input_records_size;
    }

    public Long getLast_build_time() {
        return last_build_time;
    }

    public void setLast_build_time(Long last_build_time) {
        this.last_build_time = last_build_time;
    }

    public String getLast_build_job_id() {
        return last_build_job_id;
    }

    public void setLast_build_job_id(String last_build_job_id) {
        this.last_build_job_id = last_build_job_id;
    }

    public Long getCreate_time_utc() {
        return create_time_utc;
    }

    public void setCreate_time_utc(Long create_time_utc) {
        this.create_time_utc = create_time_utc;
    }

    public Map<String, String> getDictionaries() {
        return dictionaries;
    }

    public void setDictionaries(Map<String, String> dictionaries) {
        this.dictionaries = dictionaries;
    }

    public List<Object[]> getRowkey_stats() {
        return rowkey_stats;
    }

    public void setRowkey_stats(List<Object[]> rowkey_stats) {
        this.rowkey_stats = rowkey_stats;
    }

    public Double getSwell() {
        return swell;
    }

    public void setSwell(Double swell) {
        this.swell = swell;
    }

    public Date getD_last_build_time() {
        return d_last_build_time;
    }

    public void setD_last_build_time(Date d_last_build_time) {
        this.d_last_build_time = d_last_build_time;
    }

    public Date getD_create_time_utc() {
        return d_create_time_utc;
    }

    public void setD_create_time_utc(Date d_create_time_utc) {
        this.d_create_time_utc = d_create_time_utc;
    }

    public Cube getCube() {
        return cube;
    }

    public void setCube(Cube cube) {
        this.cube = cube;
    }

    public List<Map<String, Object>> getRowkeyStats() {
        return rowkeyStats;
    }

    public void setRowkeyStats(List<Map<String, Object>> rowkeyStats) {
        this.rowkeyStats = rowkeyStats;
    }
}
